/*
 * @Descripttion:
 * @LastEditors: xzh
 * @LastEditTime: 2021-11-12 16:32:44
 */
import { defineConfig } from "vite";
import path from "path";
import vue from "@vitejs/plugin-vue";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  //解析别名
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "src"),
      "@store": path.resolve(__dirname, "src/store/modules"),
      "@storeAction": path.resolve(__dirname, "src/utils/cache/store"),
      "@constans": path.resolve(__dirname, "src/utils/constans"),
    },
  },
  server: {
    open: true,
    proxy: {
      // 代理网址
      "/api": {
        target: "http://localhost:8081/api/",
        changeOrigin: true,
        rewrite: (path) => path.replace("/api/", "/"),
      },
    },
  },
  css: {
    preprocessorOptions: {
      scss: {
        additionalData: '@import "./src/styles/variables.scss";',
      },
    },
  },
});
